using UnityEngine;

public class TriggerOnGround : MonoBehaviour
{
	private bool water;

	private bool ground;

	private Collider trigger;

	private HelicopterBehavior curHelic;

	public bool isOnGround
	{
		get
		{
			Collider[] array = listTriggerObject;
			foreach (Collider collider in array)
			{
				HelicopterBehavior componentInParent = collider.GetComponentInParent<HelicopterBehavior>();
				if (!(componentInParent == curHelic))
				{
					return true;
				}
			}
			return false;
		}
	}

	public Collider[] listTriggerObject
	{
		get
		{
			return Physics.OverlapBox(trigger.transform.position, trigger.bounds.size / 2f);
		}
	}

	public bool inWater
	{
		get
		{
			Collider[] array = listTriggerObject;
			water = false;
			ground = false;
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].tag.Equals("Dno") || array[i].tag.Equals("Water"))
				{
					water = true;
				}
				else if (!array[i].isTrigger && (!array[i].tag.Equals("Dno") & !array[i].tag.Equals("Water")))
				{
					ground = true;
				}
			}
			if (water && !ground)
			{
				return true;
			}
			return false;
		}
	}

	private void Awake()
	{
		curHelic = NGUITools.FindInParents<HelicopterBehavior>(base.transform);
		if (curHelic != null)
		{
			curHelic.triggerOnGroundSript = this;
		}
		trigger = GetComponent<Collider>();
	}
}
